<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/gui/text/qtextobject.cpp -->
<head>
  <title>Qt 4.3: QTextFrame Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QTextFrame Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QTextFrame class represents a frame in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
<pre> #include &lt;QTextFrame&gt;</pre><p>Inherits <a href="qtextobject.html">QTextObject</a>.</p>
<p>Inherited by <a href="qtexttable.html">QTextTable</a>.</p>
<ul>
<li><a href="qtextframe-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public Types</h3>
<ul>
<li><div class="fn"/>class <b><a href="qtextframe-iterator.html">iterator</a></b></li>
<li><div class="fn"/>typedef <b><a href="qtextframe.html#Iterator-typedef">Iterator</a></b></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qtextframe.html#QTextFrame">QTextFrame</a></b> ( QTextDocument * <i>document</i> )</li>
<li><div class="fn"/><b><a href="qtextframe.html#dtor.QTextFrame">~QTextFrame</a></b> ()</li>
<li><div class="fn"/>iterator <b><a href="qtextframe.html#begin">begin</a></b> () const</li>
<li><div class="fn"/>QList&lt;QTextFrame *&gt; <b><a href="qtextframe.html#childFrames">childFrames</a></b> () const</li>
<li><div class="fn"/>iterator <b><a href="qtextframe.html#end">end</a></b> () const</li>
<li><div class="fn"/>QTextCursor <b><a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qtextframe.html#firstPosition">firstPosition</a></b> () const</li>
<li><div class="fn"/>QTextFrameFormat <b><a href="qtextframe.html#frameFormat">frameFormat</a></b> () const</li>
<li><div class="fn"/>QTextCursor <b><a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qtextframe.html#lastPosition">lastPosition</a></b> () const</li>
<li><div class="fn"/>QTextFrame * <b><a href="qtextframe.html#parentFrame">parentFrame</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qtextframe.html#setFrameFormat">setFrameFormat</a></b> ( const QTextFrameFormat &amp; <i>format</i> )</li>
</ul>
<ul>
<li><div class="fn"/>4 public functions inherited from <a href="qtextobject.html#public-functions">QTextObject</a></li>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>1 protected function inherited from <a href="qtextobject.html#protected-functions">QTextObject</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QTextFrame class represents a frame in a <a href="qtextdocument.html">QTextDocument</a>.</p>
<p>Text frames provide structure for the text in a document. They are used as generic containers for other document elements. Frames are usually created by using <a href="qtextcursor.html#insertFrame">QTextCursor::insertFrame</a>().</p>
<p>Frames can be used to create hierarchical structures in rich text documents. Each document has a root frame (<a href="qtextdocument.html#rootFrame">QTextDocument::rootFrame</a>()), and each frame beneath the root frame has a parent frame and a (possibly empty) list of child frames. The parent frame can be found with <a href="qtextframe.html#parentFrame">parentFrame</a>(), and the <a href="qtextframe.html#childFrames">childFrames</a>() function provides a list of child frames.</p>
<p>Each frame contains at least one text block to enable text cursors to insert new document elements within. As a result, the <a href="qtextframe-iterator.html">QTextFrame::iterator</a> class is used to traverse both the blocks and child frames within a given frame. The first and last child elements in the frame can be found with <a href="qtextframe.html#begin">begin</a>() and <a href="qtextframe.html#end">end</a>().</p>
<p>A frame also has a format (specified using <a href="qtextframeformat.html">QTextFrameFormat</a>) which can be set with <a href="qtextobject.html#setFormat">setFormat</a>() and read with <a href="qtextobject.html#format">format</a>().</p>
<p>Text cursors can be obtained that point to the first and last valid cursor positions within a frame; use the <a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a>() and <a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a>() functions for this. The frame's extent in the document can be found with <a href="qtextframe.html#firstPosition">firstPosition</a>() and <a href="qtextframe.html#lastPosition">lastPosition</a>().</p>
<p>You can iterate over a frame's contents using the <a href="qtextframe-iterator.html">QTextFrame::iterator</a> class: this provides read-only access to its internal list of text blocks and child frames.</p>
<p>See also <a href="qtextcursor.html">QTextCursor</a> and <a href="qtextdocument.html">QTextDocument</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="fn"><a name="Iterator-typedef"></a>typedef QTextFrame::Iterator</h3>
<p>Qt-style synonym for <a href="qtextframe-iterator.html">QTextFrame::iterator</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QTextFrame"></a>QTextFrame::QTextFrame ( <a href="qtextdocument.html">QTextDocument</a> * <i>document</i> )</h3>
<p>Creates a new empty frame for the text <i>document</i>.</p>
<h3 class="fn"><a name="dtor.QTextFrame"></a>QTextFrame::~QTextFrame ()</h3>
<p>Destroys the frame, and removes it from the document's layout.</p>
<h3 class="fn"><a name="begin"></a><a href="qtextframe-iterator.html">iterator</a> QTextFrame::begin () const</h3>
<p>Returns an iterator pointing to the first document element inside the frame.</p>
<p>See also <a href="qtextframe.html#end">end</a>().</p>
<h3 class="fn"><a name="childFrames"></a><a href="qlist.html">QList</a>&lt;QTextFrame *&gt; QTextFrame::childFrames () const</h3>
<p>Returns a (possibly empty) list of the frame's child frames.</p>
<p>See also <a href="qtextframe.html#parentFrame">parentFrame</a>().</p>
<h3 class="fn"><a name="end"></a><a href="qtextframe-iterator.html">iterator</a> QTextFrame::end () const</h3>
<p>Returns an iterator pointing to the last document element inside the frame.</p>
<p>See also <a href="qtextframe.html#begin">begin</a>().</p>
<h3 class="fn"><a name="firstCursorPosition"></a><a href="qtextcursor.html">QTextCursor</a> QTextFrame::firstCursorPosition () const</h3>
<p>Returns the first cursor position inside the frame.</p>
<p>See also <a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a>(), <a href="qtextframe.html#firstPosition">firstPosition</a>(), and <a href="qtextframe.html#lastPosition">lastPosition</a>().</p>
<h3 class="fn"><a name="firstPosition"></a>int QTextFrame::firstPosition () const</h3>
<p>Returns the first document position inside the frame.</p>
<p>See also <a href="qtextframe.html#lastPosition">lastPosition</a>(), <a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a>(), and <a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a>().</p>
<h3 class="fn"><a name="frameFormat"></a><a href="qtextframeformat.html">QTextFrameFormat</a> QTextFrame::frameFormat () const</h3>
<p>Returns the frame's format.</p>
<p>See also <a href="qtextframe.html#setFrameFormat">setFrameFormat</a>().</p>
<h3 class="fn"><a name="lastCursorPosition"></a><a href="qtextcursor.html">QTextCursor</a> QTextFrame::lastCursorPosition () const</h3>
<p>Returns the last cursor position inside the frame.</p>
<p>See also <a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a>(), <a href="qtextframe.html#firstPosition">firstPosition</a>(), and <a href="qtextframe.html#lastPosition">lastPosition</a>().</p>
<h3 class="fn"><a name="lastPosition"></a>int QTextFrame::lastPosition () const</h3>
<p>Returns the last document position inside the frame.</p>
<p>See also <a href="qtextframe.html#firstPosition">firstPosition</a>(), <a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a>(), and <a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a>().</p>
<h3 class="fn"><a name="parentFrame"></a>QTextFrame * QTextFrame::parentFrame () const</h3>
<p>Returns the frame's parent frame. If the frame is the root frame of a document, this will return 0.</p>
<p>See also <a href="qtextframe.html#childFrames">childFrames</a>() and <a href="qtextdocument.html#rootFrame">QTextDocument::rootFrame</a>().</p>
<h3 class="fn"><a name="setFrameFormat"></a>void QTextFrame::setFrameFormat ( const <a href="qtextframeformat.html">QTextFrameFormat</a> &amp; <i>format</i> )</h3>
<p>Sets the frame's <i>format</i>.</p>
<p>See also <a href="qtextframe.html#frameFormat">frameFormat</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
